﻿<UserControl x:Class="Module2.Views.WorkflowViewerView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:CommandHelper="clr-namespace:Common.CommandHelper;assembly=Common"
             xmlns:Activities="clr-namespace:Common.Activities;assembly=Common"
             xmlns:prism="clr-namespace:Microsoft.Practices.Prism.Commands;assembly=Microsoft.Practices.Prism"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

            <ComboBox  x:Name="ActivityDropDown" Grid.Row="0"  DockPanel.Dock="Top"
                  ItemsSource="{Binding ActivityCV}">
            <ComboBox.ItemTemplate>
                <DataTemplate>
                    <TextBlock Text="{Binding Name}" />
                </DataTemplate>
            </ComboBox.ItemTemplate>
        </ComboBox>
        <DockPanel Grid.Row="1" >
            <Button x:Name="Complete" prism:Click.Command="{Binding CompleteCommand}" DockPanel.Dock="Bottom">
                <TextBlock>Complete</TextBlock>
            </Button>
            <ListBox x:Name="ActivityItemListBox" SelectionMode="Single" DockPanel.Dock="Top"
                 HorizontalContentAlignment="Stretch"
                 ItemsSource="{Binding BookmarkCV}">
            <ListBox.Resources>
                <SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}">#FF3399FF</SolidColorBrush>
                <Style TargetType="ListBoxItem">
                    <Style.Resources>
                        <!-- SelectedItem with focus -->
                        <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Transparent" />
                        <!-- SelectedItem without focus -->
                        <SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="Transparent" />
                        <!-- SelectedItem text foreground -->
                        <SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="Black" />
                    </Style.Resources>
                    <Setter Property="FocusVisualStyle" Value="{x:Null}" />
                </Style>
            </ListBox.Resources>
                <ListBox.BorderBrush>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="#FFAEB9A3"/>
                    <GradientStop Color="#FF83A985" Offset="0.375"/>
                    <GradientStop Color="#FF719778" Offset="0.379"/>
                    <GradientStop Color="#FF61846E" Offset="1"/>
                </LinearGradientBrush>
            </ListBox.BorderBrush>    
            <ListBox.ItemTemplate>
                    <DataTemplate>
                        <Grid>
                            <Border x:Name="dataBorderShadow" BorderBrush="Gray" BorderThickness="1"  CornerRadius="6" Margin="0,3,0,0">
                                <Border.Effect>
                                    <DropShadowEffect ShadowDepth="0" Color="Green" BlurRadius="0"/>
                                </Border.Effect>
                            </Border>
                            <Border x:Name="dataBorder" BorderThickness="1"  CornerRadius="6" Tag="{Binding Status}" Margin="0,3,0,0">
                                <Grid>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto"/>
                                    </Grid.ColumnDefinitions>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="Auto"/>
                                    </Grid.RowDefinitions>
                                    <StackPanel Grid.Column="0" Orientation="Vertical" Margin="4,6" HorizontalAlignment="Center" >
                                        <TextBlock x:Name="bookmarkValue" Text="{Binding BookmarkNameValue}" />
                                    </StackPanel>
                                </Grid>
                            </Border>
                        </Grid>
                        <DataTemplate.Triggers>
                            <DataTrigger Binding="{Binding RelativeSource={RelativeSource
                                Mode=FindAncestor,
                                AncestorType={x:Type ListBoxItem}},
                                Path=IsSelected}"
                                Value="True">
                                <Setter TargetName="dataBorderShadow" Property="Effect">
                                    <Setter.Value>
                                        <DropShadowEffect ShadowDepth="0" Color="LimeGreen" BlurRadius="10"/>
                                    </Setter.Value>
                                </Setter>
                            </DataTrigger>
                            <DataTrigger Binding="{Binding Status, Mode=OneWay}" Value="{x:Static Activities:UserStepStatus.Completed}">
                                <Setter TargetName="dataBorder" Property="BorderBrush" Value="Green"/>
                                <Setter TargetName="bookmarkValue" Property="Text" Value="Completed"/>
                            </DataTrigger>
                        </DataTemplate.Triggers>
                    </DataTemplate>
            </ListBox.ItemTemplate>
            </ListBox>
        </DockPanel>
    </Grid>
</UserControl>
